Skip to content

refactor(model_util): replace simulator_start_here_model_from with direct random_galaxy_for_simulation_from#438

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/fix-snr-model-smell-and-ci
May 22, 2026
Merged

refactor(model_util): replace simulator_start_here_model_from with direct random_galaxy_for_simulation_from#438
Jammy2211 merged 1 commit into
mainfrom
feature/fix-snr-model-smell-and-ci

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

  • Remove simulator_start_here_model_from() — it built an af.Model(lp_snr.Sersic) with signal_to_noise_ratio = af.UniformPrior(20, 60), making model.info print look like the user was fitting SNR.
  • Replace with random_galaxy_for_simulation_from(rng=None) — returns a concrete ag.Galaxy whose bulge is an lp_snr.Sersic instance sampled directly from a numpy.random.Generator. SNR appears only as a profile attribute on the instance, never as a fitting parameter.
  • Export SIMULATOR_RANDOM_GALAXY_SUMMARY (one-line replacement for the verbose model.info print used by start_here scripts).

Test plan

  • pytest test_autogalaxy/ -x -q — 908 passed
  • Structural grep: signal_to_noise_ratio.*Prior returns zero hits across autogalaxy/
  • python -c "import autogalaxy as ag; assert not hasattr(ag.model_util, 'simulator_start_here_model_from')" passes

Coordinated PRs

  • PyAutoLens — feature/fix-snr-model-smell-and-ci (sibling change for al.model_util)
  • autogalaxy_workspace — feature/fix-snr-model-smell-and-ci (callers + CI fix)
  • autolens_workspace — feature/fix-snr-model-smell-and-ci (callers)

Library-first merge gate per CLAUDE.md: this PR + the PyAutoLens PR should merge before the workspace PRs.

🤖 Generated with Claude Code

…rect random_galaxy_for_simulation_from

The old helper built an af.Model around lp_snr.Sersic and exposed
signal_to_noise_ratio as a UniformPrior — making model.info print look
like the reader was fitting SNR (they were not, the model was only used
for .random_instance()). Replace with random_galaxy_for_simulation_from,
which returns a concrete Galaxy by sampling each parameter directly from
a numpy.random.Generator and constructing lp_snr.Sersic as a profile
*instance*. SNR is a property of the data, not a fit parameter; this
removes the misleading prior surface.

Also exports SIMULATOR_RANDOM_GALAXY_SUMMARY as a one-line replacement
for the verbose model.info print used by the start_here scripts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit 2655f2f into main May 22, 2026
6 checks passed
@Jammy2211 Jammy2211 deleted the feature/fix-snr-model-smell-and-ci branch May 22, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant